import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/esm/inherits";

var _class, _temp;

import React from "react";
import intl from "cpaas-front/lib/utils/intl";
import { BlockContainer } from "./index.style";
import SectionTitle from "../_components/SectionTitle";
import ConfigItem from "../_components/ConfigItem";
import withFormOperate from "../_components/withFormOperate";
import { getMemoizedAssets } from "./util";

var TabConfig = withFormOperate(_class = (_temp = /*#__PURE__*/function (_React$Component) {
  _inherits(TabConfig, _React$Component);

  function TabConfig() {
    var _getPrototypeOf2;

    var _this;

    _classCallCheck(this, TabConfig);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(TabConfig)).call.apply(_getPrototypeOf2, [this].concat(args)));
    _this.getCard = getMemoizedAssets(_this.props.styleCounts.tabsCard, "tab");
    _this.getTabs = getMemoizedAssets(_this.props.styleCounts.tabs, "tab/tab");
    return _this;
  }

  _createClass(TabConfig, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          handleChange = _this$props.handleChange,
          value = _this$props.value,
          schema = _this$props.schema;
      return React.createElement(BlockContainer, {
        id: "tab-config"
      }, React.createElement(SectionTitle, {
        title: "\u5207\u6362",
        titleTail: "Tab"
      }), React.createElement(ConfigItem, {
        cols: 2,
        title: intl.get("cpaas.cpaasTheme.page.cardType").d("卡片类型"),
        items: this.getTabs(schema),
        onChange: handleChange("tabsCard"),
        defaultSelected: value.tabsCard
      }), React.createElement(ConfigItem, {
        cols: 2,
        title: intl.get("cpaas.cpaasTheme.components.tabs").d("切换"),
        items: this.getCard(schema),
        onChange: handleChange("tabs"),
        defaultSelected: value.tabs
      }));
    }
  }]);

  return TabConfig;
}(React.Component), _temp)) || _class;

export { TabConfig as default };
